Skip to content

Docs LLM accessibility: add llms.txt, allow copying and viewing pages as markdown#581

Open
aatuvai wants to merge 13 commits intomainfrom
aatuvai/2026-03-10-docs-llm-usage
Open

Docs LLM accessibility: add llms.txt, allow copying and viewing pages as markdown#581
aatuvai wants to merge 13 commits intomainfrom
aatuvai/2026-03-10-docs-llm-usage

Conversation

@aatuvai
Copy link
Contributor

@aatuvai aatuvai commented Mar 10, 2026

The first iteration of features dedicated to providing LLMs better context of the docs site.

New features:

  • Generate a markdown version each docs page (for example /docs/get-started gets a markdown version in /docs/get-started.md)
  • Generate a llms.txt file (available at /docs/llms.txt)
  • Add "Copy for LLM" and "View as markdown" options to the docs page actions:
Screenshot 2026-03-17 at 15 52 13

A new Docusaurus plugin, @signalwire/docusaurus-plugin-llms-txt, is installed for the task of generating the markdown pages and the llms.txt file. The plugin is configured in a new file /server/llms/index.ts.

List of changes:

  • Adds @signalwire/docusaurus-plugin-llms-txt to the list of dependencies in package.json
  • Adds the @signalwire/docusaurus-plugin-llms-txt plugin to the Docusaurus plugins configuration in docusaurus.config.ts
  • Adds a configuration file for the @signalwire/docusaurus-plugin-llms-txt plugin in /server/llms/index.ts
  • Adds 4 rehype plugins to /server/llms/, which are used in the @signalwire/docusaurus-plugin-llms-txt plugin:
    • rehype-process-custom-components.ts: Used to process custom components for cleaner markdown output
    • rehype-remove-heading-anchor-links.ts: Prevents the automatically created heading anchor links from appearing in the markdown output
    • rehype-remove-irrelevant-components.ts: Prevents components not useful for AI to appear in the markdown output
    • rehype-reposition-h1.ts: Ensures the page title is correctly applied to the markdown version of the page
  • Adds unit tests for the rehype plugins.
  • Adds fixtures used in the rehype unit tests /server/fixtures/llms
  • Adjusts the styles of the PageActions component to accommodate the design changes found in Figma
    • As a part of the style changes, adds two new icons.
  • Fixes a type mismatch error with unist, which caused some unit tests to fail (/server/unist-augment.d.ts)

@socket-security
Copy link

socket-security bot commented Mar 10, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​signalwire/​docusaurus-plugin-llms-txt@​2.0.0-alpha.78710010097100

View full report

@github-actions
Copy link

github-actions bot commented Mar 10, 2026

Amplify deployment status

Branch Commit Job ID Status Preview Updated (UTC)
aatuvai/2026-03-10-docs-llm-usage b0de7e0 11 ✅SUCCEED aatuvai-2026-03-10-docs-llm-usage 2026-03-19 13:06:39

@aatuvai aatuvai marked this pull request as ready for review March 17, 2026 15:04
@aatuvai aatuvai requested review from ptgott, rodgtr1 and roraback March 17, 2026 15:04
@aatuvai aatuvai deployed to docs-amplify March 19, 2026 12:57 — with GitHub Actions Active
@ptgott
Copy link
Contributor

ptgott commented Mar 19, 2026

I had Claude Code compare the preview site and current docs site, and it concluded that the preview site provides more information, particularly by not hiding all tab items but the selected one in Tabs components. I still need to dive into the actual code.

Copy link
Contributor

@ptgott ptgott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a partial review (I still need to look at the PageActions code, src/utils/markdown.ts, and docusaurus.config.ts). I had a nitpicky question about how we organize the plugin code and, more importantly, a question about hardcoding descriptions of docs sections and Teleport as a whole. Thanks for working on this!

import rehypeProcessCustomComponentsForMarkdown from "./rehype-process-custom-components";

// Define the sections for the llms.txt index file, including their routes and descriptions
const sections = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to generate this from the docs content or check that it is correct? With the current approach, the LLM version of the docs will eventually drift from the human version of the docs.

enableDescriptions: true,
siteTitle: "Teleport documentation",
siteDescription:
"Teleport is an identity-based access platform that secures servers, Kubernetes clusters, databases, internal applications, and desktops using short-lived certificates, detailed audit logging, and fine-grained role-based access controls tied to your SSO provider (e.g., Okta, GitHub, Google Workspace).",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also wondering if we can generate the description. If we change our top-level messaging strategy, for example, I can see a situation in which we forget to update this and give LLMS an outdated impression of the product.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to combine this with rehype-process-custom-components.ts? Then we could name the plugin after the purpose—preparing the HTML for LLMS—rather than whether the components are custom or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we combine this with the other rehype LLM preparation plugins?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same with this one: would it make sense to consolidate visitParents calls and have a single plugin?

If that's too unwieldy and there's no performance difference, I can see the case for a few small plugins in the llms directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants